#include <iostream>
#include <unistd.h>
#include <signal.h>
#include <sys/types.h>
#include <stdlib.h>

void handler(int sig_num)
{
    std::cout << "我是：" << getpid() << ", 我获得一个信号：" << sig_num << std::endl;
}

int main()
{
    for (int i = 1; i < 31; i++)
    {
        signal(i, handler);
    }
    while(true)
    {
        std::cout << "I'm a process, I am waiting signal! " << std::endl;
        int n = kill(getpid(), 2);
        sleep(1);        
        abort();
    }
    return 0;
}